<template>
	<view class="m-t-20">
		<block v-if="list.length!=0">
			<view class="bg-white br20 p-l-20 p-r-20 p-b-20" v-for="(item,index) in list" @longpress="rateClick(item.id,item.user_id)">
				<!-- <u-gap height="1" bg-color="#ddd"></u-gap> -->
				<view class="m-t-18">
					<view class="flex row-between p-t-10 p-b-10">
						<view class="flex">
							<view class="" style="border-radius: 50%;overflow: hidden;width: 60upx;height: 60upx;" >
								<image :src="base + '/' + item.avatar" mode="" style="width: 60upx;height: 60upx;"></image>
							</view>
							<view class="m-r-20 nr m-l-10 line-1" style="">{{item.nickname}}</view>
							<view>
								<u-rate v-model="item.star" :disabled="true" size="18"></u-rate>
							</view>
						</view>
						<view class="xs" style="color:#a5a5a5">{{item.create_time}}</view>
					</view>
					<view class="m-t-20 flex flex-wrap" v-if="item.label_lists.length!=0">
						<view class="label-item" v-for="item3 in item.label_lists" :key="item3.id">
							{{item3.name}}
						</view>
					</view>
					
					<view class="m-t-20   lighter">
						{{item.details || '暂无说明'}}
					</view>
					<view class="m-t-20 flex flex-wrap m-b-20" v-if="item.file_list.length!=0">
						<template v-for="(item2,index2) in item.file_list"  >
							<view class="file-item m-r-20 m-t-10" @click="preImg(index,index2)">
								<image :src="item2" mode="" class="" ></image>
							</view>
						</template>
					</view>
				</view>
			</view>
		</block>
	</view>
</template>

<script>
	import {
		baseURL
	}
	from '@/config/app'
	import {
		mapGetters,
		mapActions
	} from 'vuex'
	export default {
		name:"com-item",
		data() {
			return {
				base:baseURL
			};
		},
		props:{
			list:{
				type:Array,
				default:()=>[]
			},
			bold:{
				type:Boolean,
				default:()=>false
			},
			isClick:{
				type:Boolean,
				default:()=>true
			}
		},
		beforeMount() {
			
		},
		methods:{
			rateClick(id,user_id){
				if(this.userInfo.id == user_id){
					this.$emit('rateClick',id)
				}
				
			},
			preImg(index,index2){
				let arr = this.list[index].file_list.map(item=>{
					return item
				})
				console.log(arr);
				
				uni.previewImage({
					current:index2,
					urls:arr,
					success:res=>{
						console.log(res)
					},
					fail:err=>{
						console.log(err)
					}
				})
			}
		},
		computed:{
			...mapGetters(['userInfo']),
			isType(type){
				return function(type){
					if (type == 3) {
						return "差评";
					} 
					if (type == 2) {
						return "中评";
					} 
					if(type == 1){
						return "好评";
					}
				}
				
			}
		}
		
	}
</script>

<style scoped>
	.ev-level{
		color: #ff7979;
		background-color: #fef1e8;
		padding: 5upx 8upx;
		
	}
	.con {
	    padding: 30rpx 24rpx;
	}
	.file-item{
		width: 150upx;
		height: 150upx;
	}
	.file-item image{
		width:100%;
		height: 100%;
		display: inline-block;
		border-radius: 8upx;
		overflow: hidden;
	}
	.label-item{
		padding: 5upx 10upx;
		border: 1upx solid #A5A5A5;
		border-radius: 5upx;
		color: #A5A5A5;
	}
</style>
